#include <iostream>
#define M 100
using namespace std;

//邻接矩阵存储结构
struct AMGraph {
    char vexs[M];
    int arcs[M][M];
    int vexnum, arcnum;
};

int main()
{
    //创建图的邻接矩阵
    AMGraph G = {
        {'A','B','C','D','D'},
        {
            {0, 1, 0, 1},
            {0, 0, 1, 0},
            {1, 0, 0, 0},
            {0, 1, 1, 0}
        },
        4, 6,
    };

    //打印顶点
    for(int i = 0; i < G.vexnum; i++) {
        if(i > 0) cout << " ";
        cout << G.vexs[i];
    }
    cout << endl;

    //打印邻接矩阵
    for(int i = 0; i < G.vexnum; i++) {
        for(int j = 0; j < G.vexnum; j++) {
            if(j > 0) cout << " ";
            cout << G.arcs[i][j];
        }
        cout << endl;
    }
    return 0;
}